package Java20241113;

public class Animal {
    public String name;
    public int age ;

    public void eat() {
        System.out.println("正在吃饭");
    }

    public void sleep() {
        System.out.println("正在睡觉");
    }
}
    class Dog extends Animal {
         void bark(){
             System.out.println(name+"汪汪汪");
         }
    }
    class Cat extends Animal{
        void mew(){
            System.out.println(name+"喵喵喵");
        }
    }

    class TestExend{
        public static void main(String[] args) {
            Dog dog = new Dog();
            System.out.println(dog.name);
            System.out.println(dog.age);
            dog.eat();
            dog.sleep();
            dog.bark();
            //_____________________________
            Cat cat = new Cat();
            System.out.println(cat.name);
            System.out.println(cat.age);
            cat.eat();
            cat.sleep();
            cat.mew();
        }
    }


